<html xmlns="http://www.w3.org/1999/xhtml"
	xmlns:h="http://java.sun.com/jsf/html"
	xmlns:f="http://java.sun.com/jsf/core"
	xmlns:p="http://primefaces.org/ui"
	xmlns:ui="http://java.sun.com/jsf/facelets">

<h:head>
</h:head>

<h:body>
	<p:scrollPanel mode="native" style="width:100%;height:100%;">
		<h:form id="form">
			<p:growl id="growl" life="3000" />
			<p:dataTable id="tblLimitesLogradouros" var="logra"
				value="#{logradouroBean.logradouros}" paginator="true" rows="10"
				style="margin-bottom:20px" rowsPerPageTemplate="5,10,15"
				emptyMessage="Nenhum logradouro cadastrado." editable="true">

				<p:ajax event="rowEdit" listener="#{logradouroBean.onRowEdit}"
					update=":form:growl" />
				<p:ajax event="rowEditCancel"
					listener="#{logradouroBean.onRowCancel}" update=":form:growl" />

				<f:facet name="header">
						Limites de logradouros
				</f:facet>

				<p:column headerText="Código" filterBy="#{logra.codigoLogradouro}"
					filterMatchMode="contains">
					<h:outputText value="#{logra.codigoLogradouro}" />
				</p:column>

				<p:column headerText="Título" filterBy="#{logra.nomeLogradouro}"
					filterMatchMode="contains">
					<h:outputText value="#{logra.nomeLogradouro}" />
				</p:column>

				<p:column headerText="Limite inicial"
					filterBy="#{logra.codigoLimiteInicialLogradouro}"
					filterMatchMode="contains">
					<p:cellEditor>
						<f:facet name="output">
							<h:outputText value="#{logra.codigoLimiteInicialLogradouro}" />
						</f:facet>
						<f:facet name="input">
							<p:inputMask mask="9?9999999" required="true"
								requiredMessage="Código do logradouro do limite inicial não informado!"
								value="#{logra.codigoLimiteInicialLogradouro}" />
						</f:facet>
					</p:cellEditor>
				</p:column>

				<p:column headerText="Limite final"
					filterBy="#{logra.codigoLimiteFinalLogradouro}"
					filterMatchMode="contains">
					<p:cellEditor>
						<f:facet name="output">
							<h:outputText value="#{logra.codigoLimiteFinalLogradouro}" />
						</f:facet>
						<f:facet name="input">
							<p:inputMask mask="9?9999999" required="true"
								requiredMessage="Código do logradouro do limite final não informado!"
								value="#{logra.codigoLimiteFinalLogradouro}" />
						</f:facet>
					</p:cellEditor>
				</p:column>

				<p:column headerText="DSQ do limite inicial"
					filterBy="#{logra.dsqLimiteInicialLogradouro}"
					filterMatchMode="contains">
					<p:cellEditor>
						<f:facet name="output">
							<h:outputText value="#{logra.dsqLimiteInicialLogradouro}" />
						</f:facet>
						<f:facet name="input">
							<p:inputMask mask="99.9999.9999" required="true" maxlength="12"
								requiredMessage="DSQ do limite inicial não informado!"
								value="#{logra.dsqLimiteInicialLogradouro}" />
						</f:facet>
					</p:cellEditor>
				</p:column>

				<p:column headerText="DSQ do limite final"
					filterBy="#{logra.dsqLimiteFinalLogradouro}"
					filterMatchMode="contains">
					<p:cellEditor>
						<f:facet name="output">
							<h:outputText value="#{logra.dsqLimiteFinalLogradouro}" />
						</f:facet>
						<f:facet name="input">
							<p:inputMask mask="99.9999.9999" required="true" maxlength="12"
								requiredMessage="DSQ do limite final não informado!"
								value="#{logra.dsqLimiteFinalLogradouro}" />
						</f:facet>
					</p:cellEditor>
				</p:column>

				<p:column headerText="Prancha inicial"
					filterBy="#{logra.pranchaLimiteInicialLogradouro}"
					filterMatchMode="contains">
					<p:cellEditor>
						<f:facet name="output">
							<h:outputText value="#{logra.pranchaLimiteInicialLogradouro}" />
						</f:facet>
						<f:facet name="input">
							<p:inputMask mask="999999" required="true"
								requiredMessage="Código de prancha do limite inicial não informado!"
								value="#{logra.pranchaLimiteInicialLogradouro}" />
						</f:facet>
					</p:cellEditor>
				</p:column>

				<p:column headerText="Prancha final"
					filterBy="#{logra.pranchaLimiteFinalLogradouro}"
					filterMatchMode="contains">
					<p:cellEditor>
						<f:facet name="output">
							<h:outputText value="#{logra.pranchaLimiteFinalLogradouro}" />
						</f:facet>
						<f:facet name="input">
							<p:inputMask mask="999999" required="true"
								requiredMessage="Código de prancha do limite final não informado!"
								value="#{logra.pranchaLimiteFinalLogradouro}" />
						</f:facet>
					</p:cellEditor>
				</p:column>

				<p:column>
					<p:rowEditor />
				</p:column>

			</p:dataTable>

			<h3>Exportar</h3>
			<h:commandLink>
				<p:graphicImage url="imagens/excel.png" width="24" />
				<p:dataExporter type="xls" target="tblLimitesLogradouros"
					fileName="lograsLimites" pageOnly="true" />
			</h:commandLink>

			<h:commandLink>
				<p:graphicImage url="imagens/pdf.png" width="24" />
				<p:dataExporter type="pdf" target="tblLimitesLogradouros"
					fileName="lograsLimites" pageOnly="true" />
			</h:commandLink>

		</h:form>
	</p:scrollPanel>
</h:body>

</html>